Optimal. Leaf size=90 \[ -\frac {3 x}{2 a}-\frac {2 i \log (\cos (c+d x))}{a d}+\frac {3 \tan (c+d x)}{2 a d}-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3631, 3609,
3606, 3556} \begin {gather*} -\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {i \tan ^2(c+d x)}{a d}+\frac {3 \tan (c+d x)}{2 a d}-\frac {2 i \log (\cos (c+d x))}{a d}-\frac {3 x}{2 a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3631
Rubi steps
\begin {align*} \int \frac {\tan ^4(c+d x)}{a+i a \tan (c+d x)} \, dx &=-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \tan ^2(c+d x) (3 a-4 i a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \tan (c+d x) (4 i a+3 a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {3 x}{2 a}+\frac {3 \tan (c+d x)}{2 a d}-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {(2 i) \int \tan (c+d x) \, dx}{a}\\ &=-\frac {3 x}{2 a}-\frac {2 i \log (\cos (c+d x))}{a d}+\frac {3 \tan (c+d x)}{2 a d}-\frac {i \tan ^2(c+d x)}{a d}-\frac {\tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(196\) vs. \(2(90)=180\).
time = 1.98, size = 196, normalized size = 2.18 \begin {gather*} \frac {\cos (c) \sec (c+d x) (\cos (d x)+i \sin (d x)) \left (-6 d x-4 i \log \left (\cos ^2(c+d x)\right )+8 d x \sec ^2(c)-2 i \sec ^2(c+d x)+4 \sec (c) \sec (c+d x) \sin (d x)+\sin (2 d x)+\text {ArcTan}(\tan (d x)) (-8-8 i \tan (c))+2 i d x \tan (c)+4 \log \left (\cos ^2(c+d x)\right ) \tan (c)+2 \sec ^2(c+d x) \tan (c)+4 i \sec (c) \sec (c+d x) \sin (d x) \tan (c)-i \sin (2 d x) \tan (c)-8 d x \tan ^2(c)+\cos (2 d x) (i+\tan (c))\right )}{4 d (a+i a \tan (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.10, size = 65, normalized size = 0.72
method | result | size |
derivativedivides | \(\frac {\tan \left (d x +c \right )-\frac {i \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {7 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}+\frac {1}{2 \tan \left (d x +c \right )-2 i}+\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) | \(65\) |
default | \(\frac {\tan \left (d x +c \right )-\frac {i \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {7 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}+\frac {1}{2 \tan \left (d x +c \right )-2 i}+\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) | \(65\) |
risch | \(-\frac {7 x}{2 a}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )}}{4 d a}-\frac {4 c}{d a}+\frac {2 i}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {2 i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d a}\) | \(78\) |
norman | \(\frac {\frac {i}{d a}+\frac {\tan ^{3}\left (d x +c \right )}{d a}-\frac {3 x}{2 a}-\frac {3 x \left (\tan ^{2}\left (d x +c \right )\right )}{2 a}+\frac {3 \tan \left (d x +c \right )}{2 d a}-\frac {i \left (\tan ^{4}\left (d x +c \right )\right )}{2 d a}}{1+\tan ^{2}\left (d x +c \right )}+\frac {i \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d a}\) | \(111\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 138, normalized size = 1.53 \begin {gather*} -\frac {14 \, d x e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (28 \, d x - i\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, {\left (7 \, d x - 5 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 8 \, {\left (i \, e^{\left (6 i \, d x + 6 i \, c\right )} + 2 i \, e^{\left (4 i \, d x + 4 i \, c\right )} + i \, e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i}{4 \, {\left (a d e^{\left (6 i \, d x + 6 i \, c\right )} + 2 \, a d e^{\left (4 i \, d x + 4 i \, c\right )} + a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.23, size = 134, normalized size = 1.49 \begin {gather*} \begin {cases} \frac {i e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: a d e^{2 i c} \neq 0 \\x \left (\frac {\left (1 - 7 e^{2 i c}\right ) e^{- 2 i c}}{2 a} + \frac {7}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {2 i}{a d e^{4 i c} e^{4 i d x} + 2 a d e^{2 i c} e^{2 i d x} + a d} - \frac {7 x}{2 a} - \frac {2 i \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.97, size = 87, normalized size = 0.97 \begin {gather*} -\frac {-\frac {7 i \, \log \left (\tan \left (d x + c\right ) - i\right )}{a} - \frac {i \, \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} + \frac {2 \, {\left (i \, a \tan \left (d x + c\right )^{2} - 2 \, a \tan \left (d x + c\right )\right )}}{a^{2}} - \frac {-7 i \, \tan \left (d x + c\right ) - 5}{a {\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.01, size = 91, normalized size = 1.01 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,7{}\mathrm {i}}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{4\,a\,d}+\frac {\mathrm {tan}\left (c+d\,x\right )}{a\,d}+\frac {1{}\mathrm {i}}{2\,a\,d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}}{2\,a\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________